Xendri.setPopupTitle('Авторизация');
$('popup').removeEvents('submit');
$('popup').addEvent('submit', function(evt) {
	var login = $('login').value;
	var pass = $('pass').value;
	Xendri.Session.addEvent('fail', function() {
		$('logfail').innerHTML = 'Неверный логин или пароль.';
		$('logfail').setStyle('display', 'block');
	});
	Xendri.Session.addEvent('blocked', function() {
		$('logfail').innerHTML = 'Аккаунт заблокирован.';
		$('logfail').setStyle('display', 'block');
	});
	Xendri.Session.addEvent('user', function() {
		Xendri.closePopup();
	});
	if (login != '' && pass != '') {
		$('logfail').setStyle('display', 'none');
		
		Xendri.Session.login(login, pass, $('nocookie').checked);
	}
});